﻿Namespace B1Data
    Public Class CodeRuleDocEntry
        Inherits CodeRule
        Implements B1Data.ICodeRule

        Sub New(ByVal table As SAPBoAddon.B1Data.B1DataTable, ByVal FieldName As String)
            MyBase.New(table, FieldName)
            _FieldName = FieldName
        End Sub

        Public Overrides Function NextCode() As String
            If AutoRecordCode Then
                _CurrentCode += 1
                Return _CurrentCode
            Else
                Return _CurrentCode + 1
            End If
        End Function

        Public Overrides Sub RefreshCurrenCode()
            _CurrentCode = NextCode()
        End Sub

        Public Overrides Sub RefreshCurrenCode(ByVal Key As Object)
            If _CurrentCode < Key Then
                _CurrentCode = Key
            End If
        End Sub

        Public Overloads Overrides Function NextCode(ByVal ParamArray params() As Object) As String
            Return Nothing
        End Function
    End Class
End Namespace